<?php
function my_autoloader($class) {
    //var_dump($class);
    include $class . '.php';
}
spl_autoload_register('my_autoloader');


// 客户端调用
$objectStructure = new ObjectStructure();
// 添加男人、女人
$objectStructure->add(new ConcreteElementMan());
//var_dump($objectStructure);
$objectStructure->add(new ConcreteElementWoman());
//var_dump($objectStructure);
// 成功时反应
$success = new ConcreteVisitorSuccess();
$objectStructure->display($success);

// 失败时反应
$failing = new ConcreteVisitorFailing();
$objectStructure->display($failing);
